﻿Public Class DB

    Private Sub DB_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'PcvgppDataSet.bacsi' table. You can move, or remove it, as needed.
        Me.BacsiTableAdapter.Fill(Me.PcvgppDataSet.bacsi)
        Me.position.Text = Me.BacsiBindingSource.Position + 1
    End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Me.BacsiBindingSource.AddNew()
    End Sub

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        Me.BacsiBindingSource.EndEdit()
        If Me.PcvgppDataSet.HasChanges Then
            Me.BacsiTableAdapter.Update(Me.PcvgppDataSet.bacsi)
        Else
            MessageBox.Show("khong co thay doi du lieu !")
        End If

    End Sub

    Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
        Me.BacsiBindingSource.MovePrevious()
        Me.position.Text = Me.BacsiBindingSource.Position + 1
    End Sub

    Private Sub Button4_Click(sender As System.Object, e As System.EventArgs) Handles Button4.Click
        Me.BacsiBindingSource.MoveNext()
        Me.position.Text = Me.BacsiBindingSource.Position + 1
    End Sub

    Private Sub Button5_Click(sender As System.Object, e As System.EventArgs) Handles Button5.Click
        Me.BacsiBindingSource.MoveFirst()
        Me.position.Text = Me.BacsiBindingSource.Position + 1
    End Sub

    Private Sub Button6_Click(sender As System.Object, e As System.EventArgs) Handles Button6.Click
        Me.BacsiBindingSource.MoveLast()
        Me.position.Text = Me.BacsiBindingSource.Position + 1
    End Sub

    Private Sub Button7_Click(sender As System.Object, e As System.EventArgs) Handles Button7.Click
        If MessageBox.Show("ban co muon xoa khong ?", "", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
            Me.BacsiBindingSource.RemoveCurrent()
            Me.BacsiTableAdapter.Update(Me.PcvgppDataSet.bacsi)
        End If
       

    End Sub


    Private Sub Button8_Click(sender As System.Object, e As System.EventArgs) Handles Button8.Click
        Me.BacsiBindingSource.EndEdit()
        If MessageBox.Show("ban co muon huy thay doi khong ?", "", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
            Me.PcvgppDataSet.RejectChanges()
        End If
    End Sub
End Class